<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <title>glVertexAttrib - OpenGL ES 3 Reference Pages</title>
    <link rel="stylesheet" type="text/css" href="opengl-man.css"/>
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1"/>
    <script type="text/x-mathjax-config">
            MathJax.Hub.Config({
                MathML: {
                    extensions: ["content-mathml.js"]
                },
                tex2jax: {
                    inlineMath: [['$','$'], ['\\(','\\)']]
                }
            });
        </script>
    <script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"/>
  </head>
  <body>
    <header/>
    <div class="refentry" id="glVertexAttrib">
      <div class="titlepage"/>
      <div class="refnamediv">
        <h2>Name</h2>
        <p>glVertexAttrib — Specifies the value of a generic vertex attribute</p>
      </div>
      <div class="refsynopsisdiv">
        <h2>C Specification</h2>
        <div class="funcsynopsis">
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib1f</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v0</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib2f</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v0</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v1</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib3f</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v0</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v1</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v2</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib4f</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v0</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v1</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v2</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLfloat <var class="pdparam">v3</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttribI4i</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLint <var class="pdparam">v0</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLint <var class="pdparam">v1</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLint <var class="pdparam">v2</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLint <var class="pdparam">v3</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttribI4ui</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLuint <var class="pdparam">v0</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLuint <var class="pdparam">v1</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLuint <var class="pdparam">v2</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>GLuint <var class="pdparam">v3</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib1fv</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>const GLfloat *<var class="pdparam">v</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib2fv</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>const GLfloat *<var class="pdparam">v</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib3fv</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>const GLfloat *<var class="pdparam">v</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttrib4fv</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>const GLfloat *<var class="pdparam">v</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttribI4iv</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>const GLint *<var class="pdparam">v</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
          <table style="border: 0; cellspacing: 0; cellpadding: 0;" class="funcprototype-table">
            <tr>
              <td>
                <code class="funcdef">void <strong class="fsfunc">glVertexAttribI4uiv</strong>(</code>
              </td>
              <td>GLuint <var class="pdparam">index</var>, </td>
            </tr>
            <tr>
              <td> </td>
              <td>const GLuint *<var class="pdparam">v</var><code>)</code>;</td>
            </tr>
          </table>
          <div class="funcprototype-spacer"> </div>
        </div>
      </div>
      <div class="refsect1" id="parameters">
        <h2>Parameters</h2>
        <div class="variablelist">
          <dl class="variablelist">
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>index</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>Specifies the index of the generic vertex
            attribute to be modified.</p>
            </dd>
            <dt>
              <span class="term">
            <em class="parameter"><code>v0</code></em>,
            <em class="parameter"><code>v1</code></em>,
            <em class="parameter"><code>v2</code></em>,
            <em class="parameter"><code>v3</code></em>
        </span>
            </dt>
            <dd>
              <p>
                For the scalar commands, specifies the new values to be used
                for the specified vertex attribute.
            </p>
            </dd>
            <dt>
              <span class="term">
                <em class="parameter">
                  <code>v</code>
                </em>
              </span>
            </dt>
            <dd>
              <p>
                For the vector commands
                (<code class="function">glVertexAttrib*v</code>), specifies a pointer
                to an array of values to be used for the generic vertex
                attribute.
            </p>
            </dd>
          </dl>
        </div>
      </div>
      <div class="refsect1" id="description">
        <h2>Description</h2>
        <p>The <code class="function">glVertexAttrib</code> family of entry points
    allows an application to pass generic vertex attributes in
    numbered locations.</p>
        <p>Generic attributes are defined as four-component values
    that are organized into an array. The first entry of this array
    is numbered 0, and the size of the array is specified by the
    implementation-dependent constant
    <code class="constant">GL_MAX_VERTEX_ATTRIBS</code>. Individual elements
    of this array can be modified with a
    <code class="function">glVertexAttrib</code> call that specifies the
    index of the element to be modified and a value for that
    element.</p>
        <p>These commands can be used to specify one, two, three, or
    all four components of the generic vertex attribute specified by
    <em class="parameter"><code>index</code></em>. A <code class="function">1</code> in the
    name of the command indicates that only one value is passed, and
    it will be used to modify the first component of the generic
    vertex attribute. The second and third components will be set to
    0, and the fourth component will be set to 1. Similarly, a
    <code class="function">2</code> in the name of the command indicates that
    values are provided for the first two components, the third
    component will be set to 0, and the fourth component will be set
    to 1. A <code class="function">3</code> in the name of the command
    indicates that values are provided for the first three
    components and the fourth component will be set to 1, whereas a
    <code class="function">4</code> in the name indicates that values are
    provided for all four components.</p>
        <p>The letters <code class="function">f</code>, <code class="function">i</code>,
    and <code class="function">ui</code> indicate
    whether the arguments are of type float, int, or unsigned int. When
    <code class="function">v</code> is appended to the name, the commands can
    take a pointer to an array of such values.</p>
        <p>Additional capitalized letters can indicate further alterations
        to the default behavior of the glVertexAttrib function:</p>
        <p>
            The commands containing <code class="function">I</code> indicate that 
            the arguments are extended to full signed or unsigned integers.
        </p>
        <p>OpenGL ES Shading Language attribute variables are allowed to
    be of type mat2, mat3, or mat4. Attributes of these types may be
    loaded using the <code class="function">glVertexAttrib</code> entry
    points. Matrices must be loaded into successive generic
    attribute slots in column major order, with one column of the
    matrix in each generic attribute slot.</p>
        <p>A user-defined attribute variable declared in a vertex
    shader can be bound to a generic attribute index by calling
    <a class="citerefentry" href="glBindAttribLocation.xhtml"><span class="citerefentry"><span class="refentrytitle">glBindAttribLocation</span></span></a>.
    This allows an application to use more descriptive variable
    names in a vertex shader. A subsequent change to the specified
    generic vertex attribute will be immediately reflected as a
    change to the corresponding attribute variable in the vertex
    shader.</p>
        <p>The binding between a generic vertex attribute index and a
    user-defined attribute variable in a vertex shader is part of
    the state of a program object, but the current value of the
    generic vertex attribute is not. The value of each generic
    vertex attribute is part of current state, and it is maintained
        even if a different program object is used.</p>
        <p>An application may freely modify generic vertex attributes
    that are not bound to a named vertex shader attribute variable.
    These values are simply maintained as part of current state and
    will not be accessed by the vertex shader. If a generic vertex
    attribute bound to an attribute variable in a vertex shader is
    not updated while the vertex shader is executing, the vertex
    shader will repeatedly use the current value for the generic
    vertex attribute.</p>
      </div>
      <div class="refsect1" id="notes">
        <h2>Notes</h2>
        <p>Generic vertex attributes can be updated at any time.</p>
        <p>It is possible for an application to bind more than one
    attribute name to the same generic vertex attribute index. This
    is referred to as aliasing, and it is allowed only if just one
    of the aliased attribute variables is active in the vertex
    shader, or if no path through the vertex shader consumes more
    than one of the attributes aliased to the same location. OpenGL
    implementations are not required to do error checking to detect
    aliasing, they are allowed to assume that aliasing will not
    occur, and they are allowed to employ optimizations that work
    only in the absence of aliasing.</p>
        <p>The resulting attribute values are undefined if the base 
        type of the shader attribute at slot <em class="parameter"><code>index</code></em> 
        does not match the type of glUniform command used.
        If the attribute is floating point, the <code class="function">glUniform*f[v]</code> commands 
        should be used. If the attribute is unsigned integer, 
        the <code class="function">glUniformI4ui*</code> commands should be used. If the attribute is
        a signed integer, the <code class="function">glUniformI4i*</code> commands should be used.
        </p>
      </div>
      <div class="refsect1" id="errors">
        <h2>Errors</h2>
        <p><code class="constant">GL_INVALID_VALUE</code> is generated if
    <em class="parameter"><code>index</code></em> is greater than or equal to
    <code class="constant">GL_MAX_VERTEX_ATTRIBS</code>.</p>
      </div>
      <div class="refsect1" id="associatedgets">
        <h2>Associated Gets</h2>
        <p><a class="citerefentry" href="glGet.xhtml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a>
    with the argument <code class="constant">GL_CURRENT_PROGRAM</code></p>
        <p><a class="citerefentry" href="glGetActiveAttrib.xhtml"><span class="citerefentry"><span class="refentrytitle">glGetActiveAttrib</span></span></a>
    with argument <em class="parameter"><code>program</code></em> and the index of an active
    attribute variable</p>
        <p><a class="citerefentry" href="glGetAttribLocation.xhtml"><span class="citerefentry"><span class="refentrytitle">glGetAttribLocation</span></span></a>
    with argument <em class="parameter"><code>program</code></em> and an attribute
    variable name</p>
        <p><a class="citerefentry" href="glGetVertexAttrib.xhtml"><span class="citerefentry"><span class="refentrytitle">glGetVertexAttrib</span></span></a>
    with arguments <code class="constant">GL_CURRENT_VERTEX_ATTRIB</code> and
    <em class="parameter"><code>index</code></em></p>
      </div>
      <div class="refsect1" id="versions">
        <h2>API Version Support</h2>
        <div class="informaltable">
          <table style="border-collapse: collapse; border-top: 2px solid ; border-bottom: 2px solid ; border-left: 2px solid ; border-right: 2px solid ; ">
            <colgroup>
              <col style="text-align: left; "/>
              <col style="text-align: center; " class="firstvers"/>
              <col style="text-align: center; " class="lastvers"/>
            </colgroup>
            <thead>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; ">
                 
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; " colspan="2">
                <span class="bold"><strong>OpenGL ES API Version</strong></span>
            </th>
              </tr>
              <tr>
                <th style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>Function Name</strong></span>
            </th>
                <th style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">
                <span class="bold"><strong>2.0</strong></span>
            </th>
                <th style="text-align: center; border-bottom: 2px solid ; ">
                <span class="bold"><strong>3.0</strong></span>
            </th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib1f</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib2f</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib3f</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib4f</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttribI4i</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">-</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttribI4ui</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">-</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib1fv</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib2fv</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib3fv</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttrib4fv</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">✔</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; border-bottom: 2px solid ; ">
                  <code class="function">glVertexAttribI4iv</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; border-bottom: 2px solid ; ">-</td>
                <td style="text-align: center; border-bottom: 2px solid ; ">✔</td>
              </tr>
              <tr>
                <td style="text-align: left; border-right: 2px solid ; ">
                  <code class="function">glVertexAttribI4uiv</code>
                </td>
                <td style="text-align: center; border-right: 2px solid ; ">-</td>
                <td style="text-align: center; ">✔</td>
              </tr>
            </tbody>
          </table>
        </div>
      </div>
      <div class="refsect1" id="seealso">
        <h2>See Also</h2>
        <p><a class="citerefentry" href="glBindAttribLocation.xhtml"><span class="citerefentry"><span class="refentrytitle">glBindAttribLocation</span></span></a>,
    <a class="citerefentry" href="glVertexAttribPointer.xhtml"><span class="citerefentry"><span class="refentrytitle">glVertexAttribPointer</span></span></a></p>
      </div>
      <div class="refsect1" id="Copyright">
        <h2>Copyright</h2>
        <p>
            Copyright <span class="trademark"/>© 2003-2005 3Dlabs Inc. Ltd. 
            Copyright <span class="trademark"/>© 2010-2014 Khronos Group.
            This material may be distributed subject to the terms and conditions set forth in 
            the Open Publication License, v 1.0, 8 June 1999.
            <a class="link" href="http://opencontent.org/openpub/" target="_top">http://opencontent.org/openpub/</a>.
        </p>
      </div>
    </div>
    <footer/>
  </body>
</html>
